<template>
	<view class="u-page feedback">
		<view class="title"> 意见反馈 </view>
		<u-radio-group v-model="form.feedbackType" @change="groupChange">
			<u-radio name="0"> 建议 </u-radio>
			<u-radio name="1"> 问题 </u-radio>
		</u-radio-group>
		<textarea class="textarea" v-model="form.feedbackContent" placeholder="请输入您的宝贵意见，我们将更好地完善!" ></textarea>
		<div class="center">
			<div class="btn u-btn" @click="feedback()">提交</div>
		</div>
	</view>
</template>

<script>
	export default {
		name: "price",
		data() {
			return {
			     form:{
					 feedbackType: -1,
					 feedbackContent: '',
				 }
			};
		},
		methods: {
			async feedback() {
				var th  = this; 
				var { feedbackType, feedbackContent } = this.form
				var { userId,}  = this.$store.state.apiUserInfo;
				if(feedbackType == -1) return this.tip("请选择反馈类型")
				if(!feedbackContent) return this.tip("请输入您的宝贵意见哦")
				var res = await th.ajax(`/wx/feedback`, {  
					  "feedbackType":feedbackType,
					  "feedbackContent":feedbackContent,
					  "userId": userId,
				},'post') 
				if(res.code == 200){
					this.tip("提交反馈成功，感谢您的参与")
					this.form.feedbackContent = ''
				}else{
					this.tip("提交反馈失败")
				}
			},
		}
	}
</script>

<style lang="scss">
	.feedback{
		padding: 10px;  
		.textarea{
           width: 90%;
		   height: 100px;
		   border-radius: 10px;
		   border: 1px solid #CCC;
		   padding: 10px;
		   margin: 20px 0;
		}	
	}
  
</style>
